package com.edu.lingnan.springcloud.controller;

import com.edu.lingnan.springcloud.pojo.Dept;
import com.edu.lingnan.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author shaosen
 * @Description //TODO
 * @Date 21:39 2020/5/31
 */
@RestController
public class DeptComsumerController {

    @Resource
    private DeptClientService service = null;

    @RequestMapping("/comsumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return this.service.queryById(id);
    }

    @RequestMapping("comsumer/dept/add")
    public boolean add(Dept dept) {
        return this.service.addDept(dept);
    }

    @RequestMapping("/comsumer/dept/list")
    public List<Dept> list() {
        return this.service.queryAll();
    }
}
